<?php
namespace App\Models\Traits;

trait AppUser
{
    public function user()  //用户
    {
        return $this->belongsTo(\App\User::class, 'user_id');
    }

    public function scopeUserId($query,$user_id)  //用户过滤
    {
        if(is_numeric($user_id)){
			return $query->where('user_id',$user_id);
		}else{
			$user_id = str2arr($user_id);
			return $query->whereIn('user_id',$user_id);
		}
    }    
}
